/**
 * Copyright 2013 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.viettel.core.entities.cms;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import com.viettel.core.enumtype.ChargingHistoryStatus;
import com.viettel.core.enumtype.ChargingType;

/**
 *  LICH SU THANH TOAN
 *  @author: ToanTM1
 *  @version: 2.1
 *  @since: 03-10-2013 - 15:43:53
 */
@Entity
@Table(name = "CHARGING_HISTORY")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "CHARGING_HISTORY_SEQ", allocationSize = 1)
public class ChargingHistory implements Serializable{
	private static final long serialVersionUID = 1L;

	/**
	 * ID LICH SU
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
	@Column(name = "ID")
//	@Index(name="CHARGING_HISTORY_ID_PK")
	private Integer id;
	
	/**
	 * ID USER THANH TOAN
	 */
	@ManyToOne(targetEntity = Users.class)
	@JoinColumn(name = "USER_ID", referencedColumnName = "id")
	@ForeignKey(name = "CHARGING_HISTORY_USER_FK")
	private Users user;	

	/**
	 * SO DIEN THOAI THANH TOAN
	 */
	@Basic
	@Column(name = "MSISDN", length = 50)
	private String msisdn;
	
	/**
	 * TIEN THANH TOAN
	 */
	@Basic
	@Column(name = "CHARGING", length = 50)
	private String charging;
	
	/**
	 * THOI GIAN
	 */
	@Basic
	@Column(name = "REQ_TIME", length = 50)
	private String reqTime;
	
	/**
	 * REQUEST ID
	 */
	@Basic
	@Column(name = "REQUEST_ID", length = 50)
	private String requestID;
	
	/**
	 * NOI DUNG
	 */
	@Basic
	@Column(name = "CONTENT", length = 500)
	private String content;
	
	/**
	 * LOAI
	 */
	@Basic
	@Column(name = "TYPE", columnDefinition = "integer", nullable = false)
	@Type(type = "com.viettel.core.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "com.viettel.core.enumtype.ChargingType"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	@Index(name="CHARGING_HISTORY_TYPEX")
	private ChargingType type;
	
	/**
	 * TRANG THAI
	 */
	@Basic
	@Column(name = "STATUS", columnDefinition = "integer", nullable = false)
	@Type(type = "com.viettel.core.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "com.viettel.core.enumtype.ChargingHistoryStatus"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	@Index(name="CHARGING_HISTORY_STATUSX")
	private ChargingHistoryStatus status;
	
	/**
	 * THOI GIAN TAO
	 */
	@Basic
	@Column(name = "CREATED_TIME", columnDefinition = "timestamp(9) default systimestamp", insertable = false, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdTime;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Users getUser() {
		return user;
	}

	public void setUser(Users user) {
		this.user = user;
	}

	public String getMsisdn() {
		return msisdn;
	}

	public void setMsisdn(String msisdn) {
		this.msisdn = msisdn;
	}

	public String getCharging() {
		return charging;
	}

	public void setCharging(String charging) {
		this.charging = charging;
	}

	public String getReqTime() {
		return reqTime;
	}

	public void setReqTime(String reqTime) {
		this.reqTime = reqTime;
	}

	public String getRequestID() {
		return requestID;
	}

	public void setRequestID(String requestID) {
		this.requestID = requestID;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public ChargingType getType() {
		return type;
	}

	public void setType(ChargingType type) {
		this.type = type;
	}

	public ChargingHistoryStatus getStatus() {
		return status;
	}

	public void setStatus(ChargingHistoryStatus status) {
		this.status = status;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}
	
}
